using UnityEngine;
using System.Collections;

public class PrintEffect : CanAction
{

	public float printDuration = 0.2f;
	int printOffset = 0;
	float printNextTime = 0f;

	override protected void Update ()
	{
		base.Update ();
		if (printOffset < gameObjectSort.Count) {
			if (printNextTime <= Time.time) {
				printNextTime = Time.time + (float)printDuration;
				doAction (gameObjectSort [printOffset++]);
			}
			
		} else {
			completeAction ();
		}
	}
	
	override protected void initAction ()
	{
		foreach (GameObject go in gameObjectSort) {
			go.SetActive (false);
		}
	}
	
	override protected void doAction (GameObject go)
	{
		go.SetActive (true);
	}
	
	override protected void completeAction ()
	{
		Destroy (this);
	}
}
